home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Controls
/
Visual Basic Controls.iso
/
vbcontrol
/
xceedzip
/
BROWSE.BAS
next >
Wrap
BASIC Source File
|
1999-04-26
|
1KB
|
47 lines
Attribute VB_Name = "modBrowse"
Option Explicit
Private Type BROWSEINFO
hwndOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Private Declare Function SHBrowseForFolder Lib "shell32" (ByRef pBrowseInfo As BROWSEINFO) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidRes As Long, ByVal pszFolder As String) As Long
Private Declare Sub CoTaskMemFree Lib "ole32" (ByVal pVoid As Long)
Public Function BrowseForFolder(sFolder As String, ByVal sTitle As String) As Boolean
Dim bRes As Boolean
bRes = False
Dim bi As BROWSEINFO, pItemIDList As Long
bi.hwndOwner = 0
bi.pidlRoot = 0
bi.pszDisplayName = sFolder
bi.lpszTitle = sTitle
bi.ulFlags = 0
bi.lpfn = 0
bi.lParam = 0
bi.iImage = 0
pItemIDList = SHBrowseForFolder(bi)
If pItemIDList Then
sFolder = Space(261)
If SHGetPathFromIDList(pItemIDList, sFolder) Then
bRes = True
End If
CoTaskMemFree (pItemIDList)
End If
BrowseForFolder = bRes
End Function